package com.lin;

import com.lin.Rpc.Client;
import com.lin.Rpc.Server;
import com.lin.consumer.*;
import com.lin.util.RabbitUtil;
import com.rabbitmq.client.ConnectionFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.io.IOException;

@SpringBootApplication
public class RabbitMqLearnApplication {
    public static void main(String[] args) {
        SpringApplication.run(RabbitMqLearnApplication.class, args);

//      startTheListener
        try {
            Demo1Consumer.work(1);
            Demo1Consumer.work(2);
            Demo2Consumer.work(1);
            Demo2Consumer.work(2);
            Demo3Consumer.work(1);
            Demo3Consumer.work(2);
            Demo4Consumer.work("normal");
            Demo4Consumer.work("error");
            Demo5Consumer.work("hello.lin.ren.jun");
            Demo5Consumer.work("goodbye.*.ren.*");
            Demo5Consumer.work("hello.lin.xian.yu");
            Demo5Consumer.work("goodbye.lin.#.yu");

            Server.work();
            Client client = new Client();


            System.out.println(client.Call("2"));
            System.out.println(client.Call("5"));

        }catch (Exception e) {
            e.printStackTrace();
        }
    }
}
